package com.uday.kraterchat.chatclient.business
{
	import com.adobe.cairngorm.business.ServiceLocator;
	import com.uday.frmwrk.data.BaseRequestItem;
	import com.uday.kraterchat.chatclient.data.MessageItem;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.remoting.RemoteObject;
	
	public class ChatServiceDelegate
	{
		private var objResponder:IResponder;
		private var objRemoteSrvc:RemoteObject;
		
		public function ChatServiceDelegate(objResponder:IResponder)
		{
			this.objResponder = objResponder;
			objRemoteSrvc = ServiceLocator.getInstance().getRemoteObject("loginService");
		}
		
		public function sendMessage(objMessageItem:MessageItem):void{
			var objRequestItem:BaseRequestItem = new BaseRequestItem();
			objRequestItem.objReqData = objMessageItem;
			objRequestItem.strActivityMap = "sendMessage";
			
			var token:AsyncToken = objRemoteSrvc.execute( objRequestItem );
			token.addResponder(objResponder);
		}
	}
}